package ch03.jdkProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @author Jane
 * @date 2024-03-25 16:48
 */

public class JdkProxyFactory {
    public static <T>T getInstance(Object target){// target 目标
    /*    ClassLoader loader,
                Class<?>[] interfaces,
                InvocationHandler h*/
      return (T) Proxy.newProxyInstance(target.getClass().getClassLoader()
                            ,target.getClass().getInterfaces()
                            ,new BuyInvocationHandler(target));
    }
}
